//
//  LSZPersonalCentralDataSingleton.m
//  PartyClassCloud
//
//  Created by 梁素珍 on 2018/9/4.
//  Copyright © 2018年 九酷. All rights reserved.
//

#import "LSZPersonalCentralDataSingleton.h"

@implementation LSZPersonalCentralDataSingleton

+ (instancetype)sharedInstance {
    
    static LSZPersonalCentralDataSingleton *instance;
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        // 子类调用父类的实例化的方法
        instance = [self new];
    });
    return instance;
}
- (instancetype)init
{
    self = [super init];
    if (self) {
        [self loadMy_id];
        [self loadRealName];
        [self loadMobilePhone];
        [self loadBranch_name];
        [self loadBranch_id];
        [self loadSex];
        [self loadDepartmentScore];
        [self loadHeadUrl];
        [self loadRoleId];
        [self loadMy_summary];
        [self loadBranchName];
        [self loadMyHours];
        [self loadMyJobId];
    }
    return self;
}
-(void)setMyJobId:(NSString *)myJobId
{
    _myJobId = myJobId;
    [[NSUserDefaults standardUserDefaults] setObject:myJobId forKey:@"myJobId"];
}
-(void)loadMyJobId
{
    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"myJobId"] == nil) {
        self.myJobId = @"";
    } else {
        self.myJobId = [[NSUserDefaults standardUserDefaults] objectForKey:@"myJobId"];
    }
}
-(void)setMyHours:(NSString *)myHours
{
    _myHours = myHours;
    [[NSUserDefaults standardUserDefaults] setObject:myHours forKey:@"myHours"];
}
-(void)loadMyHours
{
    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"myHours"] == nil) {
        self.myHours = @"";
    } else {
        self.myHours = [[NSUserDefaults standardUserDefaults] objectForKey:@"myHours"];
    }
}
#pragma mark - 城市名
-(void)setBranchName:(NSString *)branchName
{
    _branchName = branchName;
    [[NSUserDefaults standardUserDefaults] setObject:branchName forKey:@"branchName"];
}
-(void)loadBranchName
{
    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"branchName"] == nil) {
        self.branchName = @"";
    } else {
        self.branchName = [[NSUserDefaults standardUserDefaults] objectForKey:@"branchName"];
    }
}
-(void)setMy_summary:(NSString *)my_summary
{
    _my_summary = my_summary;
    [[NSUserDefaults standardUserDefaults] setObject:my_summary forKey:@"my_summary"];
}
-(void)loadMy_summary
{
    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"my_summary"] == nil) {
        self.my_summary = @"";
    } else {
        self.my_summary = [[NSUserDefaults standardUserDefaults] objectForKey:@"my_summary"];
    }
}
-(void)setMy_id:(NSString *)my_id
{
    _my_id = my_id;
    [[NSUserDefaults standardUserDefaults] setObject:my_id forKey:@"my_id"];
}
-(void)loadMy_id
{
    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"my_id"] == nil) {
        self.my_id = @"";
    } else {
        self.my_id = [[NSUserDefaults standardUserDefaults] objectForKey:@"my_id"];
    }
}
-(void)setRealName:(NSString *)realName
{
    _realName = realName;
    [[NSUserDefaults standardUserDefaults] setObject:realName forKey:@"realName"];
}
///读取usercode
-(void)loadRealName{
    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"realName"] == nil) {
        self.realName = @"";
    } else {
        self.realName = [[NSUserDefaults standardUserDefaults] objectForKey:@"realName"];
    }
}

-(void)setMobilePhone:(NSString *)mobilePhone
{
    _mobilePhone = mobilePhone;
    [[NSUserDefaults standardUserDefaults] setObject:mobilePhone forKey:@"mobilePhone"];
}
///读取usercode
-(void)loadMobilePhone{
    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"mobilePhone"] == nil) {
        self.mobilePhone = @"";
    } else {
        self.mobilePhone = [[NSUserDefaults standardUserDefaults] objectForKey:@"mobilePhone"];
    }
}
-(void)setBranch_name:(NSString *)branch_name
{
    _branch_name = branch_name;
    [[NSUserDefaults standardUserDefaults] setObject:branch_name forKey:@"branch_name"];
}
///读取usercode
-(void)loadBranch_name{
    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"branch_name"] == nil) {
        self.branch_name = @"";
    } else {
        self.branch_name = [[NSUserDefaults standardUserDefaults] objectForKey:@"branch_name"];
    }
}
-(void)setBranch_id:(NSString *)branch_id
{
    _branch_id = branch_id;
    [[NSUserDefaults standardUserDefaults] setObject:branch_id forKey:@"branch_id"];
}
///读取usercode
-(void)loadBranch_id{
    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"branch_id"] == nil) {
        self.branch_id = @"";
    } else {
        self.branch_id = [[NSUserDefaults standardUserDefaults] objectForKey:@"branch_id"];
    }
}
#pragma mark - 性别
-(void)setSex:(NSString *)sex
{
    _sex = sex;
    [[NSUserDefaults standardUserDefaults] setObject:sex forKey:@"sex"];
}
-(void)loadSex
{
    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"sex"] == nil) {
        self.sex = @"";
    } else {
        self.sex = [[NSUserDefaults standardUserDefaults] objectForKey:@"sex"];
    }
}
#pragma mark - 部门的分数
-(void)setDepartmentScore:(NSString *)departmentScore
{
    _departmentScore = departmentScore;
    [[NSUserDefaults standardUserDefaults] setObject:departmentScore forKey:@"departmentScore"];
}
-(void)loadDepartmentScore
{
    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"departmentScore"] == nil) {
        self.departmentScore = @"";
    } else {
        self.departmentScore = [[NSUserDefaults standardUserDefaults] objectForKey:@"departmentScore"];
    }
}
#pragma mark - 头像
-(void)setHeadUrl:(NSString *)headUrl
{
    _headUrl = headUrl;
    [[NSUserDefaults standardUserDefaults] setObject:headUrl forKey:@"headUrl"];
}
-(void)loadHeadUrl
{
    if ((NullStringjudgment(NSStr([[NSUserDefaults standardUserDefaults] objectForKey:@"headUrl"]))).length == 0) {
        self.headUrl = @"";
    } else {
        self.headUrl = [[NSUserDefaults standardUserDefaults] objectForKey:@"headUrl"];
    }
}
#pragma mark - 角色
-(void)setRoleId:(NSString *)roleId
{
    _roleId = roleId;
    [[NSUserDefaults standardUserDefaults] setObject:roleId forKey:@"roleId"];
}
-(void)loadRoleId
{
    if ((NullStringjudgment(NSStr([[NSUserDefaults standardUserDefaults] objectForKey:@"roleId"]))).length == 0) {
        self.roleId = @"";
    } else {
        self.roleId = [[NSUserDefaults standardUserDefaults] objectForKey:@"roleId"];
    }
}
@end
